<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Useradm extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function index(){
		$this->load->view('welcome_message');
	}
	
	public function update_user() {
		$this->load->model('tbl_user');
		$data['id'] 	= $this->input->post('id');
		$data['nama']	= $this->input->post('nama_user');
		$data['email'] 	= $this->input->post('email_user');
		$data['username']= $this->input->post('username_user');
		$data['password']= $this->input->post('password_user');
		$data['konfPassword']= $this->input->post('konf_password_user');
		
		if($data['password']!=$data['konfPassword']){
			redirect('administrator/edit_user/error_admin');
		}else{
			if($data['password']!=""){
				$data['password']	= $this->encrypt->encode(base64_encode($data['password']));
				$this->tbl_user->update_userPass($data);
			}else{
				$this->tbl_user->update_user($data);
			}
			redirect("administrator/sukses_update_info");
		}
	}
	
	function get_detail_user($id){
		$this->load->model('tbl_user');
		$data['mode'] ="";
		$data['pesan']="";
		$data['query'] = $this->tbl_user->load_user($id);
        $this->load->view('admin/useradm/admin-edit-user', $data);
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */